<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@page isELIgnored="false" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE HTML>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <script type="text/javascript" src="js/jquery-1.42.min.js"></script>
    <link href="css/bootstrap.min.css" rel="stylesheet" type="text/css">
    <link href="css/font-awesome.min.css" rel="stylesheet" type="text/css">
    <link href="css/base.css" rel="stylesheet" type="text/css">
    <link href="css/index2.css" rel="stylesheet" type="text/css">
    <link href="css/reg.css" rel="stylesheet" type="text/css">
    <link rel="stylesheet" href="css/headbott.css" type="text/css"/>
    <link rel="stylesheet" href="css/ace.min.css" type="text/css"/>
    <script type="text/javascript" src="layui/layui.js"></script>
    <link href="layui/css/layui.css" rel="stylesheet">
</head>
<script>

</script>
<body>
<div id="header">
    <div class="heade-con">
        <div class="logo"><a href=""><img src="images/LOGO.png"/></a></div>
        <div class="nav posa">
            <ul>
                <li><a class="vcolor" href="index.jsp">首页</a></li>
                <li><a href="gyzc-list.jsp">公益众筹</a></li>
                <li><a href="cop.jsp">常见问题</a></li>
                <li><a href="ly-list.jsp">众筹资讯</a></li>
                <li><a href="new_product.jsp" style="">发布项目</a></li>
            </ul>
        </div>
        <div class="search">
            <form action="">
                <input type="text" class="search-txt" value="找项目">
                <input type="submit" class="search-but" value="">
            </form>
        </div>
        <div class="index-login">
            <c:if test="${user == null}">
                <a href="login.jsp">登录</a><a href="reg.jsp">注册</a><a href="./admin/admin_login.jsp">后台</a>
            </c:if>
            <c:if test="${user != null}">
                <a href="/product/getByUserId">个人中心</a><a href="user/logout" id="lout">退出</a>
            </c:if>
        </div>
    </div>
</div>

<div class="login-container">

    <div class="space-6"></div>

    <div class="position-relative">
        <div id="login-box" class="login-box visible widget-box no-border">
            <div class="widget-body">
                <div class="widget-main">
                    <h4 class="header blue lighter bigger">
                        <i class="ace-icon fa fa-coffee green"></i>
                        <span id="tit">手机验证</span>
                    </h4>

                    <div class="space-6"></div>

                    <form id="reset" action="/user/resetPwd" method="post">
                        <fieldset>
                            <label class="block clearfix">
														<span class="block input-icon input-icon-left">
                                                            <i class="ace-icon fa fa-user"></i>
															<input id="usern" type="text" class="form-control"
                                                                   name="phone"
                                                                   placeholder="邮箱或手机号码"/>

														</span>
                            </label>

                            <label class="block clearfix">
														<span class="block input-icon input-icon-left">
                                                            <i class="ace-icon fa fa-lock"></i>
															<input id="codes" type="password" name="codes"
                                                                   class="form-control"
                                                                   placeholder="请输入验证码"/>

														</span>
                            </label>

<div hidden id="newPwd">

                            <label class="block clearfix">
														<span class="block input-icon input-icon-left">
                                                            <i class="ace-icon fa fa-user"></i>
															<input id="pwd" type="text" class="form-control"
                                                                   name="password"
                                                                   placeholder="请输入新密码"/>

														</span>
                            </label>

                            <label class="block clearfix">
														<span class="block input-icon input-icon-left">
                                                            <i class="ace-icon fa fa-lock"></i>
															<input id="pwdag" type="password"
                                                                   class="form-control"
                                                                   placeholder="请再次输入新密码"/>

														</span>
                            </label>
</div>
                            <div class="clearfix">
                                <label class="inline">
                                    <button id="send" type="button" class="btn btn-sm btn-primary">发送验证码</button>
                                </label>

                                <button id="doVer" type="button" class="width-35 pull-right btn btn-sm btn-primary">
                                    <i class="ace-icon fa fa-key"></i>
                                    <span id="a1" class="bigger-110">验证</span>

                                </button>
                                <button style="display: none" id="subm" type="button" class="width-35 pull-right btn btn-sm btn-primary">
                                    <span class="bigger-110">提交</span>
                                </button>
                            </div>

                            <div class="space-4"></div>
                        </fieldset>
                    </form>


                </div><!-- /.widget-main -->
                <div class="toolbar clearfix">
                    <div>
                        <a disabled href="javascript:" data-target="#forgot-box" class="forgot-password-link">

                        </a>
                    </div>

                    <div>
                        <a id="exchange" href="javascript:" data-target="#signup-box" class="user-signup-link"><span>邮箱验证</span>
                            <i class="ace-icon fa fa-arrow-right"></i>
                        </a>
                    </div>
                </div>
            </div><!-- /.widget-body -->
        </div><!-- /.login-box -->
        <script type="text/javascript">
            var isRightTel = false;
            var isRightPwd = false;
            $(document).ready(function () {
                $("#usern").blur(function () {
                    var tel = $(this).val();
                    $.ajax({
                        url: "/user/isRightTel",
                        type: "post",
                        dataType: "json",
                        data: {phone:tel},
                        success: function (result) {
                            if(result==1){
                                isRightTel = true;
                            }else {
                                alert("您的手机号还未绑定用户");
                            }
                        },
                        error: function (result) {

                        }
                    })
                })
                $("#usern").change(function () {
                    if(isRightTel){
                        window.location.reload();
                    }
                })
                $("#exchange").click(function () {
                    var h = $("#exchange span").text();
                    if (h == '邮箱验证') {
                        $("#exchange span").text('手机验证');
                        $("#tit").text('邮箱验证');
                        $("#usern").attr("placeholder", "请输入邮箱")
                    } else if (h == '手机验证') {
                        $("#exchange span").text('邮箱验证');
                        $("#tit").text('手机验证');
                        $("#usern").attr("placeholder", "请输入手机号")
                    }
                })
                $("#send").click(function () {
                    if(isRightTel){
                        var tel = $("#usern").val();
                        $.ajax({
                            url: "/code/generate",
                            type: "post",
                            dataType: "json",
                            data: {tel: tel},
                            success: function (result) {

                            },
                            error: function (result) {

                            }
                        })
                    }else {
                        layui.use('layer', function () {
                            var layer = layui.layer;
                            layer.msg('请检查您的手机号');
                        });
                    }

                })
                $("#doVer").click(function () {
                    var phone = $("#usern").val();
                    var codes = $("#codes").val();
                    $.ajax({
                        url: "/user/verify",
                        type: "post",
                        dataType: "json",
                        data: {phone: phone, codes: codes},
                        success: function (result) {
                            if (result == 0) {
                                layui.use('layer', function () {
                                    var layer = layui.layer;
                                    layer.msg('验证失败');
                                });
                            } else if (result == 1) {
                                $("#doVer").toggle();
                                $("#subm").toggle();
                                $("#newPwd").toggle();
                            }
                        },
                        error: function (result) {

                        }
                    })
                })
                $("#pwd").blur(function () {
                    var pwd = $(this).val();
                    var pwdag = $("#pwdag").val();
                    if(pwd == pwdag) {
                        isRightPwd = true;
                    }
                })
                $("#pwdag").blur(function () {
                    var pwdag = $(this).val();
                    var pwd = $("#pwd").val();
                    if(pwd == pwdag) {
                        isRightPwd = true;
                    }
                })
                $("#subm").click(function () {
                    if(isRightPwd){
                        $("#reset").submit();
                    }
                })
            })
        </script>
        <!-- /.position-relative -->
    </div>
</div><!-- /.col -->
<div id="bottom">
    <div class="bottom-ggt"><a href=""><img src="images/bottbom_68.jpg" alt=""/></a></div>
    <div class="zc-yqlink">
        <ul>
            <li><a href="">阿里巴巴集团</a></li>
            <li><a href="">淘宝网</a></li>
            <li><a href="">天猫</a></li>
            <li><a href="">聚划算</a></li>
            <li><a href="">全球速卖通</a></li>
            <li><a href="">阿里巴巴国际交易市场</a></li>
            <li><a href="">1688</a></li>
            <li><a href="">阿里妈妈</a></li>
            <li><a href="">阿里旅行</a></li>
            <li><a href="">阿里云计算</a></li>
            <li><a href="">阿里巴巴集团</a></li>
            <li><a href="">淘宝网</a></li>
            <li><a href="">天猫</a></li>
            <li><a href="">聚划算</a></li>
            <li><a href="">全球速卖通</a></li>
            <li><a href="">阿里巴巴国际交易市场</a></li>
            <li><a href="">1688</a></li>
            <li><a href="">阿里妈妈</a></li>
            <li><a href="">阿里云计算</a></li>
        </ul>
    </div>
    <div class="footer-bd">

        <a href=" ">关于淘宝</a>
        <a href=" ">合作伙伴</a>
        <a href=" ">营销中心</a>
        <a href=" ">廉正举报</a>
        <a href=" ">联系客服</a>
        <a href=" ">开放平台</a>
        <a href=" ">诚征英才</a>
        <a href=" ">联系我们</a>
        <a href=" ">网站地图</a>
        <a href=" ">法律声明</a>　　　
        <em>© 2003-2015 Taobao.com 版权所有</em><br>

        <br>
        <span>网络文化经营许可证：<a href="">浙网文[2013]0268-027号</a></span>
        <b>|</b>
        <span data-spm-protocol="i">增值电信业务经营许可证：<a href="">浙B2-20080224-1</a></span>
        <b>|</b>
        <span>信息网络传播视听节目许可证：1109364号</span>
        <b>|</b>
        <span>举报电话:0571-81683755</span>
    </div>
</div>
</body>
</html>
